package com.somsoft.handjc.activity.rank.xuncha;

import org.json.JSONObject;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

import com.somsoft.handjc.activity.R;
import com.somsoft.handjc.util.MyApplication;
import com.somsoft.handjc.util.Utils;
import com.somsoft.handjc.util.XunChaDataUtil;

public class JiXiaoRankDetailActivity extends Activity {


	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MyApplication.getInstance().addActivity(this);
		setContentView(R.layout.common_detail);
		setTitle("效能巡查—绩效排名明细");
		try {
			Intent it = getIntent();
			String deptName = it.getStringExtra("deptName");
			getData(deptName);
		} catch (Exception e) {
			Toast.makeText(JiXiaoRankDetailActivity.this, "加载数据失败！", Toast.LENGTH_SHORT).show();
		}
		Utils.closeLoading();
	}

	private void getData(String deptName) throws Exception{
		try {
			JSONObject obj = XunChaDataUtil.getJiXiaoRankDetail(deptName);
			String txt = "";
			txt += "部门排名："+obj.get("rank")+"\n";
			txt += "部门名称："+obj.get("deptName")+"\n";
			txt += "时间监察正常："+obj.get("timeNormal")+"\n";
			txt += "时间监察黄牌："+obj.get("timeYellow")+"\n";
			txt += "时间监察红牌："+obj.get("timeRed")+"\n";
			
			txt += "异常监察正常："+obj.get("ycNormal")+"\n";
			txt += "异常监察黄牌："+obj.get("ycYellow")+"\n";
			txt += "异常监察红牌："+obj.get("ycRed")+"\n";
			
			txt += "巡查监察正常："+obj.get("xcNormal")+"\n";
			txt += "巡查监察黄牌："+obj.get("xcYellow")+"\n";
			txt += "巡查监察红牌："+obj.get("xcRed")+"\n";
			
			txt += "累计加分："+obj.get("totalAdd")+"\n";
			txt += "累计减分："+obj.get("totalCut")+"\n";
			txt += "最终得分："+obj.get("totalScore")+"\n";
			
			
			((TextView)findViewById(R.id.commonDetail)).setText(txt);
		} catch (Exception e) {
			throw e;
		}
	}
}
